package com.fractalist.android.ads;

import java.util.ArrayList;

public class AdFractalist {
	private String m_strVer;
	private int m_iClickResult;
	private int m_iInterval;
	private ArrayList<AdContent> m_arrayContents;
	
	AdFractalist(){
		m_strVer = "1.0";
		m_iClickResult = 1;
		m_iInterval = 60;
		m_arrayContents = new ArrayList<AdContent>();
	}
	
	public String getVersion() {
		return m_strVer;
	}
	public void setVersion(String strVer) {
		m_strVer = strVer;
	}
	
	public int getResult() {
		return m_iClickResult;
	}
	public void setResult(int iResult) {
		m_iClickResult = iResult;
	}

	public int getInterval() {
		return m_iInterval;
	}
	public void setInterval(int iInterval) {
		m_iInterval = iInterval;
	}

	public int getContentCount() {
		return m_arrayContents.size();
	}
	public AdContent getContent(int index) {
		if (m_arrayContents.size() > index && index >= 0) {
			return m_arrayContents.get(index);
		}
		return null;
	}
	public void addContent(AdContent data) {
		m_arrayContents.add(data);
	}
	public void removeContent(int index) {
		if (m_arrayContents.size() > index && index >= 0) {
			m_arrayContents.remove(index);
		}
	}
	public void clear() {
		m_arrayContents.clear();
	}
	
	public String getContentString() {
		String ret = "{Content:" + m_iInterval + ":" + m_arrayContents.size() + "}";
		for (int i = 0; i < m_arrayContents.size(); i++) {
			AdContent ad = m_arrayContents.get(i);
			if (ad != null) {
				ret += "{" + ad.getDec() + ":" + ad.getClickUrl() + "}"; 
			}
		}
		return ret;
	}
	
}
